<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.prime.com.tr/ui">

    <ui:composition template="/template/DefaultTemplate.xhtml">
 
        <ui:define name="content">
            <h:panelGroup id="messagePanel" layout="block">
<!--                <h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>-->
            </h:panelGroup>
            <h:form prependId="false">
                <p:panel toggleable="true" id="salesLeadEdit" header="Edit Sales Lead Details">
                <h:panelGrid columns="3">
                      
                    <h:outputLabel value="User Name: " for="name" />
                    <p:inputText binding="#{userName}"  disabled="true" id="name" value="#{salesLeadEntityController.selected.name}" title="#{bundle.EditSalesLeadEntityTitle_name}" 
                                 required="true" requiredMessage="UserName is missing" validator ="#{systemUserEntityController.validateUserName}"/>
                    <h:message styleClass="errorMsg" for= "name"/>
             
                      <h:outputLabel value="Title: " for="title" />
                    <h:selectOneMenu id="title" value="#{salesLeadEntityController.selected.title}" title="#{bundle.EditSalesLeadEntityTitle_title}" >
                        <f:selectItems value="#{systemUserEntityController.userTitles}"/>
                    </h:selectOneMenu>
                    <h:message styleClass="errorMsg" for= "title"/>
                    
                    <h:outputLabel value="FirstName: " for="firstName" />
                    <p:inputText id="firstName" value="#{salesLeadEntityController.selected.firstName}" title="#{bundle.EditSalesLeadEntityTitle_firstName}" required="true" requiredMessage="First name is missing"/>
                    <h:message styleClass="errorMsg" for= "firstName"/>
                    
                    <h:outputLabel value="LastName: " for="lastName" />
                    <p:inputText id="lastName" value="#{salesLeadEntityController.selected.lastName}" title="#{bundle.EditSalesLeadEntityTitle_lastName}" required="true" requiredMessage="Last name is missing" />
                    <h:message styleClass="errorMsg" for= "lastName"/>
                    
                    
                    <h:outputLabel value="Company Name: " for="companyName" />
                    <p:inputText required ="true" requiredMessage="Company name is missing" id="companyName" value="#{salesLeadEntityController.selected.companyName}" title="#{bundle.EditSalesLeadEntityTitle_companyName}" />
                    <h:message styleClass="errorMsg" for= "companyName"/>
                    
                    <h:outputLabel value="Job Title: " for="jobTitle" />
                    <p:inputText id="jobTitle" value="#{salesLeadEntityController.selected.jobTitle}" title="#{bundle.EditSalesLeadEntityTitle_jobTitle}" required="true" requiredMessage="Job title is missing"/>
                    <h:message styleClass="errorMsg" for= "jobTitle"/>
      
                      <h:outputLabel value="Customer Type: " for="customerType" />
                    <h:selectOneMenu id="customerType" value="#{salesLeadEntityController.selected.customerType}" title="customerType" >
                        <f:selectItems value="#{salesLeadEntityController.customerType}"/>
                    </h:selectOneMenu>                    
                    <h:message styleClass="errorMsg" for= "customerType"/>
                    </h:panelGrid>
                </p:panel>
                <br/>
                <p:panel toggleable="true" id="salesLeadContact" header="Contact Details">
                    <h:panelGrid columns="3">
                    <h:outputLabel value="Contact Number: " for="contactNumber" />
                    <p:inputText id="contactNumber" value="#{salesLeadEntityController.selected.contact.contactNumber}" title="#{bundle.EditSalesLeadEntityLabel_contactNumber}" >
                    </p:inputText>
                    <h:message styleClass="errorMsg" for= "contactNumber"/>
                    
                    <h:outputLabel value="Email: " for="email" />
                    <p:inputText  id="email" value="#{salesLeadEntityController.selected.contact.email}" title="#{bundle.EditSalesLeadEntityLabel_email}" >
                    </p:inputText>
                    <h:message styleClass="errorMsg" for= "email" />
                  </h:panelGrid>    
                </p:panel>
                <br />
                      <ui:include src="/entities/addressEntity/EditAddress.xhtml"/>
                
                <br />
            
                <p:commandButton ajax="false" action="#{salesLeadEntityController.update}" value="#{bundle.EditSalesLeadEntitySaveLink}"/>
                <p:commandButton ajax="false" action="View" value="#{bundle.EditSalesLeadEntityViewLink}" immediate="true"/>
                
            </h:form>
           
        </ui:define>
    </ui:composition>

</html>
